package nosqlconnect.toolbarActions;

import nosqlconnect.Activator;
import nosqlconnect.dialogs.NewConnectionDlg;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;

public class TNewConnectionAction extends Action implements IWorkbenchAction {

	public TNewConnectionAction(){
		setText("New");
		setToolTipText("Create a new connection");
		setImageDescriptor(Activator.getImageDescriptor("icons/plus.png"));
	}
	
	public void run() {  
		  
		/*Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();  
		String dialogBoxTitle = "New";  
		String message = "New connection?";  
		MessageDialog.openInformation(shell, dialogBoxTitle, message); */
		
		NewConnectionDlg dlg = new NewConnectionDlg(Display.getCurrent().getActiveShell());
		dlg.open();
	}
	
	@Override
	public void dispose() {
		// TODO Auto-generated method stub
		
	}
}
